/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mesActions;

import Sessions.EcomCustomersRemote;
import com.opensymphony.xwork2.ActionSupport;
import entityBeans.Productsstore;
import java.rmi.RemoteException;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.apache.struts2.interceptor.SessionAware;

/**
 *
 * @author SOGOBA
 */
public class storeAction extends ActionSupport implements SessionAware{
    
    List<Productsstore> stores;
    EcomCustomersRemote ecomCust;
    private Map <String, Object>session;
    
    public List<Productsstore> getProduits(){
        return stores;
        
    }
    

    @Override
    public void setSession(Map<String, Object> map) {
        this.session=map;
    }
    
    @Override
public String execute(){
        try {
            InitialContext sc = new InitialContext();
            //    StringBuffer res = new StringBuffer();
            ecomCust=(EcomCustomersRemote) sc.lookup("java:global/StoreEcom/StoreEcom-ejb/EcomCustomers");
            stores=ecomCust.getStores();
            this.session.put("custumer", ecomCust);
        } catch (RemoteException ex) {
            Logger.getLogger(storeAction.class.getName()).log(Level.SEVERE, null, ex);
        } catch (NamingException ex) {
            Logger.getLogger(storeAction.class.getName()).log(Level.SEVERE, null, ex);
        }
    return"mesStores";
}
}
